package com.ashlikun.flutter_anim_test

import android.app.Activity
import android.app.Application
import android.content.Intent
import android.os.Bundle
import android.util.Log
//import com.idlefish.flutterboost.FlutterBoost
//import com.idlefish.flutterboost.FlutterBoostDelegate
//import com.idlefish.flutterboost.FlutterBoostRouteOptions
//import com.idlefish.flutterboost.FlutterBoostSetupOptions
//import com.idlefish.flutterboost.containers.FlutterBoostActivity
import io.flutter.embedding.android.FlutterActivityLaunchConfigs.BackgroundMode
import io.flutter.embedding.engine.FlutterEngine


/**
 * 作者　　: 李坤
 * 创建时间: 2025/1/22　13:40
 * 邮箱　　：496546144@qq.com
 *
 * 功能介绍：
 */
class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        io.flutter.Log.setLogLevel(io.flutter.Log.VERBOSE)
        Log.d("MyApp", "onCreate")
        registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
            override fun onActivityCreated(p0: Activity, p1: Bundle?) {
                Log.d("onActivityCreated", p0.javaClass.simpleName)
            }

            override fun onActivityStarted(p0: Activity) {
            }

            override fun onActivityResumed(p0: Activity) {
            }

            override fun onActivityPaused(p0: Activity) {
            }

            override fun onActivityStopped(p0: Activity) {
            }

            override fun onActivitySaveInstanceState(p0: Activity, p1: Bundle) {
            }

            override fun onActivityDestroyed(p0: Activity) {
            }
        })
//        FlutterBoost.instance().setup(this, object : FlutterBoostDelegate {
//            override fun pushNativeRoute(options: FlutterBoostRouteOptions) {
//                Log.d("pushNativeRoute", options.pageName())
//                //这里根据options.pageName来判断你想跳转哪个页面，这里简单给一个
//                val intent = Intent(FlutterBoost.instance().currentActivity(), Page1Activity::class.java)
//                FlutterBoost.instance().currentActivity().startActivityForResult(intent, options.requestCode())
//            }
//
//            override fun pushFlutterRoute(options: FlutterBoostRouteOptions) {
//                Log.d("pushFlutterRoute", options.pageName())
//                val intent = FlutterBoostActivity.CachedEngineIntentBuilder(FlutterBoostActivity::class.java)
//                    .backgroundMode(BackgroundMode.transparent)
//                    .destroyEngineWithActivity(false)
//                    .uniqueId(options.uniqueId())
//                    .url(options.pageName())
//                    .urlParams(options.arguments())
//                    .build(FlutterBoost.instance().currentActivity())
//                FlutterBoost.instance().currentActivity().startActivity(intent)
//            }
//        }, { engine: FlutterEngine? ->
//            Log.d("onFlutterEngineCreated", "onFlutterEngineCreated ${engine}")
//        })
    }
}